package com.china08.yxyapi.repository.mg.attendance;

import java.util.List;

import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import com.china08.yxyapi.entity.mg.attendance.YxyStuAttendance;

/**
 * 学生到班考勤
 *
 */

public interface YxyStuAttendanceRepository extends MongoRepository<YxyStuAttendance, String> {

    List<YxyStuAttendance> findByDayDate(Integer dayDate);

    List<YxyStuAttendance> findByClassIdAndSchoolIdAndDayDate(String classId, String schoolId, Integer dayDate);

    YxyStuAttendance findTopByDayDateAndSchoolId(Integer dayDate, String schoolId);

    @Query(value = "{ 'dayDate' : ?0, 'schoolId' : ?1 }", fields = "{ 'studentId' : 1 }")
    List<YxyStuAttendance> findByDayDateAndSchoolId(Integer dayDate, String schoolId);

    // 查询晨检到班列表
    List<YxyStuAttendance> findBySchoolIdAndMonthDateAndStudentIdIn(String schoolId, Integer monthDate,
            List<String> studentId);
}
